package migrations

import (
	"github.com/goravel/framework/contracts/database/schema"
	"github.com/goravel/framework/facades"
)

type M20250303170414CreateModulesTable struct {
}

// Signature The unique signature for the migration.
func (r *M20250303170414CreateModulesTable) Signature() string {
	return "20250303170414_create_modules_table"
}

// Up Run the migrations.
func (r *M20250303170414CreateModulesTable) Up() error {
	if !facades.Schema().HasTable("modules") {
		return facades.Schema().Create("modules", func(table schema.Blueprint) {
			table.ID()
			table.String("name")
			table.String("title")
			table.String("description")
			table.String("image")
			table.String("author")
			table.String("version")
			table.Timestamps()
		})
	}

	return nil
}

// Down Reverse the migrations.
func (r *M20250303170414CreateModulesTable) Down() error {
	return facades.Schema().DropIfExists("modules")
}
